package org.nanfang.text;

import org.nanfang.dao.StaffDao;
import org.nanfang.dao.impl.StaffDaoimpl;
import org.nanfang.dao.impl.StaffDaoimplDbUtils;
import org.nanfang.entity.Staff;

import java.sql.SQLException;
import java.util.List;

public class testStaffsDUtils {
    public static void main(String[] args) {

        /*
        //添加
        StaffDao staffDao = new StaffDaoimplDbUtils();
        Staff staff = new Staff();
        staff.setName("田七");
        staff.setAge(20);
        staff.setPhone("120");
        staff.setStaPos("需求分析师");

        int r = 0;
        try {
            r = staffDao.insert(staff);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

        if(r==1) {
            System.out.println("添加成功");
        } else {
            System.out.println("添加失败");
        }
        */

        /*
        //删除
        StaffDao staffDao = new StaffDaoimplDbUtils();
        staffDao.delete(1);
        int x = 0 ;
        if (x == 1){
            System.out.println("删除成功");
        }else {
            System.out.println("删除失败");
        }
        * */




//        StaffDao staffDao = new StaffDaoimplDbUtils();
//        staffDao.selectById(7);



        /*
        //分页
        StaffDao staffDao = new StaffDaoimplDbUtils();
        List<Staff> list = staffDao.selectByPage(1, 2);
        list.forEach(System.out::println);
         */

    }
}
